# Configure and build main program 'coptic'

coptic_list = Split("""contactlist.c
                        interface.c
                        keyfile.c
                        main.c
                        regproto.c
                        signal.c
                        textwrap.c
                        utf8.c""")


coptic_env = Environment()
conf = Configure(coptic_env)
if not conf.CheckLib('ncursesw'):
        print 'Did not find libncursesw, exiting!'
        Exit(1)
if not conf.CheckLib('panel'):
        print 'Did not find libpanel, exiting!'
        Exit(1)
coptic_env = conf.Finish()

coptic_env.Append(CCFLAGS = '-Wall')
coptic_env.ParseConfig('pkg-config --cflags --libs glib-2.0')

# Build MSN module

msn_list = Split("""libs/msn/main.c""")

msn_env = Environment()
msn_env.Append(CCFLAGS = '-Wall -I.')
msn_env.ParseConfig('pkg-config --cflags --libs glib-2.0 openssl')
msn_lib = msn_env.StaticLibrary('copticmsn', msn_list)

coptic_env.Append(CCFLAGS = '-DHAVE_MSN')

coptic_env.Program('coptic', coptic_list + msn_lib)
coptic_env.Install('/usr/bin', 'coptic')
coptic_env.Alias('install', '/usr/bin')
